﻿using System.Globalization;
using Medianamik.Core;
using Medianamik.Core.DAL;
using Medianamik.Core.DAL.Repositories;
using Medianamik.Core.DAL.Services;
using SubSonic;

namespace Medianamik.UI.Web.Shop.Data.Repositories
{
    public class OrderItemRepository<TCollection, TItem> : MedianamikRepository<TCollection, TItem>,
                                                                IOrderItemRepository<TItem>
        where TItem : Interfaces.IOrderItem, IRecordBase, new()
        where TCollection : ICollectionWithChildren<TCollection, TItem>, new()
    {
        public OrderItemRepository(ICultureService cultureService, IContentStateService contentStateService, INodeMapper nodeMapper) : base(cultureService, contentStateService, nodeMapper)
        {
        }

        public override System.Collections.Generic.IList<TItem> ChildsOf(System.Guid nodeId, bool inclusive, int maxDepth)
        {
            return ChildsOf(nodeId, inclusive, maxDepth, CultureInfo.InvariantCulture, 
                            ContentState.Draft, ActiveStatus.All);
        }
    }

    public class OrderItemRepository : OrderItemRepository<OrderItemCollection, OrderItem>, IOrderItemRepository
    {
        public OrderItemRepository(ICultureService cultureService, IContentStateService contentStateService, INodeMapper nodeMapper)
            : base(cultureService, contentStateService, nodeMapper)
        {
        }
    }

    public interface IOrderItemRepository<T> : IMedianamikRepository<T>
        where T : Interfaces.IOrderItem
    {
    }

    public interface IOrderItemRepository :IOrderItemRepository<OrderItem>
    {
    }
}
